/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository;

import com.yihu.wlyy.entity.HospitalMapping;
import com.yihu.wlyy.entity.address.Hospital;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;
import java.util.Map;

/**
 * 医院映射接口
 **/
public interface HospitalMappingDao extends PagingAndSortingRepository<HospitalMapping, Long>,JpaSpecificationExecutor<HospitalMapping>  {

	@Query(value="select a.photo from dm_hospital a,wlyy_hospital_mapping b where a.code = b.code and b.mapping_code = ?1 and b.type=?2",nativeQuery = true)
	String getPhotoByMappingCode(String mappingCode,String type);

	@Query("select a.mappingCode from HospitalMapping a where a.code=?1 and a.type=?2")
	String getMappingCode(String code,String type);

	@Query("select a.code from HospitalMapping a where a.mappingCode=?1 and a.type=?2")
	String getCodeByMapping(String mappingCode,String type);
}
